{% extends "base.html" %}
{% load tags %}
{% block title %}Projektų vadovo ataskaita{% endblock %}
{% block content %}
<h1 class="headerText">Projekto ataskaita</h1>
<table class="infoTable">
  <tbody>
    <tr>
      <td >Kodas</td>
      <td >{{ project.projectId }}</td>
    </tr>
    <tr>
      <td >Pavadinimas</td>
      <td >{{ project.project }}</td>
    </tr>
    <tr>
      <td>Vadovas</td>
      <td><a href="/project/list/{{ project.manager }}">{{ project.manager }}</a></td>
    </tr>
    <tr>
      <td>Vadovo skyrius</td>
      <td>
        <a href="/department/manager/{{ project.departmentId }}">
          {% firstof project.department project.departmentId %}
        </a>
      </td>
    </tr>
    <tr>
      <td >Projekto pradžia</td>
      <td >{{ project.started|date:"Y-m" }}</td>
    </tr>
    <tr>
      <td>Projekto pabaiga</td>
      <td >{{ project.finished|date:"Y-m" }}</td>
    </tr>
    <tr>
      <td>Aprašas</td>
      <td>{% ifequal e.percent None %}Duomenų nėra{% else %}{{ project.description }}{% endifequal %}</td>
    </tr>
  </tbody>
</table>
<br />
<br />
<table class="reportTable thickHeader" >
  <thead>
    <tr>
      <th>Skyrius</th>
      <th>Dalyvis</th>
      <th>Išdirbtos valandos</th>
    </tr>
  </thead>
  <tbody>
    {% for member in project.members %}
      <tr>
        <td rowspan="{{ member.3|length|add:'1' }}">{% firstof member.0 member.1 %}</td>
      </tr>
      {% for name, workhours in member.3.items %}
        <tr class="{{ forloop.counter|oddOrEven }}">
          <td><a href="/personal/{{ name }}">{{ name }}</a></td>
          <td>{{ workhours }}</td>
        </tr>
      {% endfor %}
      <tr class="subTotal">
        <td colspan="2">{% firstof member.0 member.1 %} skyriaus išdirbtos valandos:</td>
        <td>{{ member.2 }}</td>
      </tr>
    {% endfor %}
  </tbody>
  <tfoot>
    <tr>
      <td colspan="2">Visų skyrių išdirbtos valandos:</td>
      <td>{{ project|sumDepartmentMembersTotal:"members,2"}}</td>
    </tr>
  </tfoot>
</table>
<br />
<br />
{% endblock %}
